<?php

namespace App\Models;

use App\Services\CarService;

class Car extends Base
{
    const STATUS_WAIT_APPOINT = 0;
    const STATUS_APPOINT_ED = 1;
    const STATUS_SIGN_IN = 2;
    const STATUS_SIGN_OUT = 3;
    const STATUS_NOTIFY = 4;
    const STATUS_CANCEL = 5;

    public static function get_sign_in_total($cur_date) {
        return CarService::getByStatusTotal(Appoint::STATUS_SIGN_IN, $cur_date);
    }

    public static function get_front_queue_total($car) {
        return CarService::getFrontQueueTotal($car);
    }


    public function appoint_user() {
        return $this->belongsTo(User::class, 'appoint_user_id');
    }

    public function sign_in_user() {
        return $this->belongsTo(User::class, 'sign_in_user_id');
    }

    public function sign_out_user() {
        return $this->belongsTo(User::class, 'sign_out_user_id');
    }

    public function cancel_user() {
        return $this->belongsTo(User::class, 'cancel_user_id');
    }
    
}
